package com.app.java.url;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;


public class TestMain {

	/**
	 * @param args
	 * @throws MalformedURLException 
	 */
	public static void main(String[] args) throws MalformedURLException {
		URL url = new URL("http://localhost:8080/utils/parseXml.url.jsp");
		List<String> queue = new ArrayList<String>();
		for(int i=0;i<10;i++){
			String hubxml="<?xml version='1.0'?>"+
			"<MT>  "+
			"	<USER_NAME>324</USER_NAME>  "+
			"	<PASSWORD>423</PASSWORD>  "+
			"	<TRX_ID>=========== TestURL " + i + " ===========</TRX_ID>	<!-- MTDetail.hubs_mt_id -->"+
			"	<MSISDN>+32476957733</MSISDN>  "+
			"	<PRICE>0</PRICE>  "+
			"	<DCS>7b</DCS>  "+
			"	<ACK_LEVEL>1</ACK_LEVEL>  "+
			"	<ACK_URL>http://mthubresponse2.funmobilebe.com/MTResponse</ACK_URL>  "+
			"	<OPERATOR_ID>3202</OPERATOR_ID>  "+
			"	<TEXT>Nog steeds geinteresseerd in jouw item? Stuur nu"+
			"YES naar 3377. Help: 02-6260025</TEXT>"+
			"	<CONTENT_TYPE_ID>117</CONTENT_TYPE_ID>"+
			"	<PRIORITY>0</PRIORITY>"+
			"</MT>";
			
			queue.add(hubxml);
		}
		 
		UrlTestThread[] mtSenders = new UrlTestThread[10];
		for(int i=0;i<mtSenders.length;i++)
			mtSenders[i] = new UrlTestThread(url,queue,10);
		
		for(int i=0; queue.size()>0 && i<10 && i<queue.size(); i++)
		{
			if(!mtSenders[i].startSender())
				--i;
		}
	}

}
